package com.bsy.videostation.repository

import com.bsy.network.repository.BaseRepository
import com.bsy.videostation.manager.ApiManager.api
import com.bsy.videostation.model.req.ReqLoginModel
import com.bsy.videostation.model.res.AppSourceItem
import com.bsy.videostation.model.res.PanelInfo
import com.bsy.videostation.model.res.UserInfo
import com.bsy.videostation.model.res.VideoCategoryItem
import com.bsy.videostation.model.res.VideoInfo

/**
 * Created by since on 2024/5/30.
 * Copyright
 * 描述：
 */
class MainRepository : BaseRepository() {

    /**
     * 账号登录
     * @param loginName  账号
     * @param password  密码
     */
    suspend fun passwordLogin(loginName: String, password: String): UserInfo? {
        return requestResponse {
            api.passwordLogin(ReqLoginModel(loginName = loginName, loginPwd = password))
        }
    }

    /**
     * 获取面板Id
     */
    suspend fun getPanelInfo(): PanelInfo? {
        return requestResponse { api.getPanelInfo() }
    }

    /**
     * 获取视频列表
     *
     * @param id 所属分类 67:不限 66:体育 65:品牌 64:旅游 63:音乐 62:生活 61:购物 60:教育 33:游戏 32:应用 31:影视
     * @returnå
     */
    suspend fun getVideoListById(id: String): VideoInfo? {
        return requestResponse { api.getVideoList(id) }
    }

    /**
     * 获取视频的分类信息
     *
     * @return
     */
    suspend fun getCategoryList(): MutableList<VideoCategoryItem>? {
        return requestResponse { api.getVideoCategoryList() }
    }

    /**
     * 获取第三方app列表
     *
     * @return
     */
    suspend fun getAppInfoList(): MutableList<AppSourceItem>? {
        return requestResponse { api.getAppInfoList() }
    }

    /**
     * 视频分类所有列表
     *
     * @return
     */
    suspend fun getVideoAllList(): VideoInfo? {
        return requestResponse { api.getVideoAllList() }
    }

}